<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情</title>
    <link rel="stylesheet" href="CSS/common.css">
    <link rel="stylesheet" href="CSS/blog_detail.css">

    <!-- 引入 editor.md 的依赖 -->
    <link rel="stylesheet" href="editor.md/css/editormd.min.css" />
    <script src="JS/jquery.min.js"></script>
    <script src="editor.md/lib/marked.min.js"></script>
    <script src="editor.md/lib/prettify.min.js"></script>
    <script src="editor.md/editormd.js"></script>
</head>
<body>
    <!-- 导航栏 -->
    <div class="nav">
        <!-- logo -->
        <img src="image/🐋.jpg" alt="">
        <!-- 标题 -->
        <span class="title">我的博客系统</span>
        <!-- 空白的占位符 -->
        <span class="spacer"></span>
        <!-- 右侧的几个链接 -->
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a th:if="${showDeleteBtn}" th:href="${'blogDelete?blogId=' + blog.blogId}">删除</a>
        <a href="logout">注销</a>
    </div>

    <!-- 版心 -->
    <div class="container">
            <!-- 左侧个人信息 -->
            <div class="left">
                <!-- 个人信息卡片 -->
                <div class="card">
                    <img src="image/头像.jpg" alt="">
    
                    <h3 th:text="${user.username}"></h3>
                    <a href="">gitee 地址</a>
    
                    <div class="counter">
                        <span>文章</span>
                        <span>分类</span>
                    </div>
                    <div class="counter">
                        <span th:text="${blogNum}"></span>
                        <span>无</span>
                    </div>
                </div>
            </div>

            <!-- 右侧文章内容 -->
            <div class="right">
                <!-- 这个 div 对应博客详情的整个部分 -->
                <div class="blog-content">
                    <!-- 博客标题 -->
                    <h3 th:text="${blog.title}"></h3>
                    <!-- 博客发布时间 -->
                    <div class="date" th:text="${blog.postTime}"></div>
                    <!-- 博客正文 -->
                    <div id="content" th:text="${blog.content}" style="background-color: transparent;"></div>
                </div>
            </div>
    </div>
    <script>
        function renderMD(){
            let contentDiv = document.querySelector('#content');
            let markdown = contentDiv.innerHTML;
            // 要把 contentDiv 里的内容先清空
            contentDiv.innerHTML = '';
            editormd.markdownToHTML('content',{
                markdown: markdown
            });
        }
        renderMD();
    </script>
</body>
</html>